@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>AddressSearchAccordion</title>
</head>
<body>
    <script type="text/javascript">

        jQuery(document).ready(function () {
            $("#Nav").hide();
            $("#applicationaccordion3").accordion();
            $("#applicationaccordion2").accordion();
            
            $('#trgSearch').click(function (event) {
var myUrl ="./Application/Search?ApplicationName=" + $("#ApplicationName").val();
                $.ajax({
                    url: '@Url.Content("~/Application/ApplicationGrid/")',
                    cache: false,
                    success: function (html) {
                        $("#applicationaccordion3").accordion("activate", 1);
                        $('#Applicationsearch').html(html);
                        $("#applicationlist").setGridParam({ datatype: 'json', url: myUrl }).trigger("reloadGrid");
                        $('#applicationlist').jqGrid('setGridParam', { onSelectRow: function (ids) {
                        ApplicationID = ids ;
                            $.ajax({
                                url: '@Url.Content("~/Application/ApplicationDetails/")' + ApplicationID,
                                cache: false,
                                success: function (html) {
                                    $('#Applicationreview').html(html);

                                }
                            });
                            $("#applicationaccordion3").accordion("activate", 2);
                        }
                        });
                    }
                });

            });

			 $('#Details').click(function(event) {
				$.ajax({
					url: '@Url.Content("~/Application/ApplicationDetails/")' + ApplicationID,
					cache: false,
					success: function (html) {
					$('#Dialog').html(html);
					$('#Dialog').dialog({modal:true});
					return false;
				}});
			});
			 $('#Add').click(function(event) {
				$.ajax({
					url: '@Url.Content("~/Application/NewApplicationForm/")',
					cache: false,
					success: function (html) {
					$('#Dialog').html(html);
					$('#Dialog').dialog({modal:true});
					return false;
				}});
			});
			 $('#Update').click(function(event) {
				$.ajax({
					url: '@Url.Content("~/Application/UpdateApplicationForm/")' + ApplicationID,
					cache: false,
					success: function (html) {
					$('#Dialog').html(html);
					$('#Dialog').dialog({modal:true});
					return false;
				}});
			});
			 $('#Search').click(function(event) {
				$.ajax({
					url: '@Url.Content("~/Application/ApplicationSearch/")' + ApplicationID,
					cache: false,
					success: function (html) {
					$('#Main').html(html);
					return false;
				}});
			});
			 $('#Remove').click(function(event) {
				$.ajax({
					url: '@Url.Content("~/Application/RemoveApplicationForm/")' + ApplicationID,
					cache: false,
					success: function (html) {
					$('#Dialog').html(html);
					$('#Dialog').dialog({modal:true});
					return false;
				}});
			});
						 $('#ApplicationRoles1').click(function(event) {
								$.ajax({
									url: '@Url.Content("~/ApplicationRoles/ApplicationRolesGrid/")',
									cache: false,
									success: function (html) {
									$('#Main').html(html);
									$("#applicationroleslist").setGridParam({ datatype: 'json', url: "./ApplicationRoles/GetBy_Application_ApplicationRoles_ByParent/" + ApplicationID }).trigger("reloadGrid");
									return false;
								}});
								$.ajax({
									url: '@Url.Content("~/ApplicationRoles/ApplicationRolesAccordion/")',
									cache: false,
									success: function (html) {
									$('#Nav').html(html);
									$('#Nav').show();
									return false;
								}});
							});
							 $('#ApplicationUser1').click(function(event) {
									$.ajax({
										url: '@Url.Content("~/ApplicationUser/ApplicationUserGrid/")',
										cache: false,
										success: function (html) {
										$('#Main').html(html);
										$("#applicationuserlist").setGridParam({ datatype: 'json', url: "./ApplicationUser/GetBy_Application_ApplicationUser_ByParent/" + ApplicationID }).trigger("reloadGrid");
										return false;
									}});
									$.ajax({
										url: '@Url.Content("~/ApplicationUser/ApplicationUserAccordion/")',
										cache: false,
										success: function (html) {
										$('#Nav').html(html);
										$('#Nav').show();
										return false;
									}});
								});
								 $('#ApplicationProfileData1').click(function(event) {
										$.ajax({
											url: '@Url.Content("~/ApplicationProfileData/ApplicationProfileDataGrid/")',
											cache: false,
											success: function (html) {
											$('#Main').html(html);
											$("#applicationprofiledatalist").setGridParam({ datatype: 'json', url: "./ApplicationProfileData/GetBy_Application_ApplicationProfileData_ByParent/" + ApplicationID }).trigger("reloadGrid");
											return false;
										}});
										$.ajax({
											url: '@Url.Content("~/ApplicationProfileData/ApplicationProfileDataAccordion/")',
											cache: false,
											success: function (html) {
											$('#Nav').html(html);
											$('#Nav').show();
											return false;
										}});
									});
								        });
								    </script>
								    <div id="applicationaccordion3">
										<h3><a href="#">Step 1: application Search</a></h3>
									    <div>
								            Application Name: <input type="text" name="ApplicationName" id="ApplicationName" />
								            <input type="button" value="Search" id="trgSearch" />
								        </div>
								
								        <h3><a href="#">Step 2: application Select</a></h3>
									    <div>
								           <div id="Applicationsearch"></div>
								        </div>
								
								        <h3><a href="#">Step 3: application Review</a></h3>
									    <div>
								           <div id="Applicationreview"></div>
								        </div>
								
								        <h3><a href="#">Step 4: application Relationships</a></h3>
									    <div>
								           <div id="Applicationrelate">
								            <div id="applicationaccordion2">
								    <h3><a href="#">Edit Options</a></h3>
								     <ul>
								<li><a href="#" id="Add">Add</a></li>
								<li><a href="#" id="Update">Update</a></li>
								<li><a href="#" id="Search">Search</a></li>
								<li><a href="#" id="Remove">Remove</a></li>
								<li><a href="#" id="Details">Details</a></li>
										
									 </ul>
									 
									  <h3><a href="#">Related Items</a></h3>
									  <ul>
											 <li><a href="#" id='ApplicationRoles1'>Application Roles</a></li>
											 <li><a href="#" id='ApplicationUser1'>Application User</a></li>
											 <li><a href="#" id='ApplicationProfileData1'>Application Profile Data</a></li>
								               
								            </ul>
								    </div>
								            </div>
								        </div>
								    </div>
								</body>
								</html>